package hrms.service;

import hrms.dao.SortMapper;
import hrms.entity.Sort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("SortService")
public class SortService {
    @Autowired
    private SortMapper sortMapper;

    public void addSort(Sort sort){
        sortMapper.insert(sort);
    }

    public void deleteSort(int id){
        sortMapper.deleteByPrimaryKey(id);
    }

    public Sort findSortById(int id){
        return sortMapper.selectByPrimaryKey(id);
    }

    public Sort findSortByName(String name){ return sortMapper.selectByName(name); }

    public List<Sort> findAllSorts(){
        return sortMapper.selectAll();
    }
}
